home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / bc_pas_1.zip / PLAY.H < prev    next >
Text File  |  1992-06-15  |  5KB  |  186 lines

  1. /*$Author:   BCRANE  $*/
  2. /*$Date:   15 Jun 1992 10:15:58  $*/
  3. /*$Header:   W:/sccs/inc/play.h_v   1.0   15 Jun 1992 10:15:58   BCRANE  $*/
  4. /*$Log:   W:/sccs/inc/play.h_v  $
  5.  * 
  6.  *    Rev 1.0   15 Jun 1992 10:15:58   BCRANE
  7.  * Initial revision.
  8. */
  9. /*$Logfile:   W:/sccs/inc/play.h_v  $*/
  10. /*$Modtimes$*/
  11. /*$Revision:   1.0  $*/
  12. /*$Workfile:   PLAY.H  $*/
  13.  
  14.     /*\
  15.     |*|----=====< PLAY.H >====----
  16.     |*|
  17.     |*|  This module holds the various definitions for the
  18.     |*|  ".VOC" file contents.
  19.     |*|
  20.     |*| Copyright (c) 1991, Media Vision, Inc.    All Rights Reserved.
  21.     |*|
  22.     \*/
  23.  
  24.     /*\
  25.     |*| Sound Blaster ".VOC" file definition
  26.     \*/
  27.  
  28.     typedef struct {
  29.         char     id[20];        /* name             */
  30.         unsigned voice_offset;    /* offset to data block     */
  31.         unsigned version;        /* version            */
  32.         unsigned check_code;    /* garbage            */
  33.     } VOCHDR;
  34.  
  35.  
  36.     /*\
  37.     |*| Data Block Structures
  38.     \*/
  39.  
  40.     /* types of data blocks                     */
  41.  
  42. #define TERMINATOR    0x00        /* terminator block type    */
  43. #define VOICEDATA    0x01        /* voice data block        */
  44. #define VOICECONTINUE    0x02        /* more voice data block    */
  45. #define SILENCE     0x03        /* silence period        */
  46. #define MARKER        0x04        /* marker for syncing        */
  47. #define ASCIITEXT    0x05        /* ascii zstring data        */
  48. #define REPEAT        0x06        /* repeat next blocks x times    */
  49. #define ENDREPEAT    0x07        /* end repeat marker        */
  50.  
  51.     /* Common Header to each data block                */
  52.  
  53.         typedef struct {
  54.         char btype;        /* block type            */
  55.         char bsize[3];        /* 24 bits for block size    */
  56.         } bVOCDATAHDR;
  57.  
  58.     /* voice data block (#1)                    */
  59.  
  60.         typedef struct {
  61.         char btype;        /* block type            */
  62.         char bsize[3];        /* 24 bits for block size    */
  63.         char sampler;        /* sample rate            */
  64.         char packtype;        /* packing 8/4/2.6/2 bits    */
  65.         } bVOCDATA;
  66.  
  67.     /* voice continuation (#2)                    */
  68.  
  69.         typedef struct {
  70.         char btype;        /* block type            */
  71.         char bsize[3];        /* 24 bits for block size    */
  72.         } bCONTINUE;
  73.  
  74.     /* Silence (#3)                         */
  75.  
  76.         typedef struct {
  77.         char btype;        /* block type            */
  78.         char bsize[3];        /* 24 bits for block size    */
  79.         int  period;        /* period in sample units    */
  80.         char sampler;        /* sample rate            */
  81.         } bSILENCE;
  82.  
  83.     /* Marker (#4)                            */
  84.  
  85.         typedef struct {
  86.         char btype;        /* block type            */
  87.         char bsize[3];        /* 24 bits for block size    */
  88.         int  marker;        /* marker ID            */
  89.         } bMARKER;
  90.  
  91.     /* ASCII zstring text (#5)                    */
  92.  
  93.         typedef struct {
  94.         char btype;        /* block type            */
  95.         char bsize[3];        /* 24 bits for block size    */
  96.         char text;        /* ascii zstring text        */
  97.         } bASCII;
  98.  
  99.     /* Repeat Loop (#6)                        */
  100.  
  101.         typedef struct {
  102.         char btype;        /* block type            */
  103.         char bsize[3];        /* 24 bits for block size    */
  104.         char count;        /* # of times to repeat (-1)    */
  105.         } bREPEAT;
  106.  
  107.     /* End Repeat Loop (#7)                     */
  108.  
  109.         typedef struct {
  110.         char btype;        /* block type            */
  111.         char bsize[3];        /* 24 bits for block size    */
  112.         } bENDREP;
  113.  
  114.  
  115.     /*\
  116.     |*|----====< ".WAV" file definition >====----
  117.     |*|
  118.     |*|     4 bytes 'RIFF'
  119.     |*|     4 bytes <length>
  120.     |*|     4 bytes 'WAVE'
  121.     |*|     4 bytes 'fmt '
  122.     |*|     4 bytes  <length>        ; 10h - length of 'data' block
  123.     |*|     2 bytes  01         ; format tag
  124.     |*|     2 bytes  01         ; channels (1=mono, 2=stereo)
  125.     |*|     4 bytes  xxxx        ; samples per second
  126.     |*|     4 bytes  xxxx        ; average samples per second
  127.     |*|     2 bytes  01/02/04        ; block alignment
  128.     |*|     2 bytes  08/16        ; bits per sample
  129.     |*|     4 bytes 'data'
  130.     |*|     4 bytes <length>
  131.     |*|       bytes <sample data>
  132.     |*|
  133.     \*/
  134.  
  135.     /* Wave format control block                    */
  136.  
  137.         typedef struct {
  138.         int  formatTag;        /* format category        */
  139.         int  nChannels;        /* stereo/mono            */
  140.         long nSamplesPerSec;    /* sample rate            */
  141.         long nAvgBytesPerSec;    /* stereo * sample rate     */
  142.         int  nBlockAlign;        /* block alignment (1=byte)    */
  143.         int  nBitsPerSample;    /* # byte bits per sample    */
  144.     } WaveInfo;
  145.  
  146.     typedef struct {
  147.         char name[4];
  148.         long length;
  149.         WaveInfo info;
  150.     } WaveFormat;
  151.  
  152.     /* Data header which follows a WaveFormat Block            */
  153.  
  154.         typedef struct {
  155.         char name[4];
  156.         unsigned long length;
  157.     } DataHeader;
  158.  
  159.     /* Total Wave Header data in a wave file                */
  160.  
  161.         typedef struct {
  162.         char name[4];
  163.         WaveFormat fmt;
  164.         DataHeader data;
  165.     } WaveHeader;
  166.  
  167.     /* Riff wrapper around the WaveFormat Block (optional)        */
  168.  
  169.     typedef struct {
  170.         char name[4];
  171.         long length;
  172.     } RiffHeader;
  173.  
  174.     /* Riff wrapped WaveFormat Block                    */
  175.  
  176.     typedef struct {
  177.         RiffHeader riff;
  178.         WaveHeader wave;
  179.     } RiffWave;
  180.  
  181.  
  182.     /*\
  183.     |*| end of PLAY.H
  184.     \*/
  185.  
  186.